package com.example.seckill.infrastructure.repostiry;

import com.example.seckill.domain.model.Product;
import com.example.seckill.domain.repository.ProductRepository;
import org.springframework.stereotype.Repository;

import java.util.Optional;

/**
 * @author Martin
 */
@Repository
public class ProductRepositoryImpl implements ProductRepository {
    private final PgsqlProductRepository repository;

    public ProductRepositoryImpl(PgsqlProductRepository repository) {
        this.repository = repository;
    }

    @Override
    public Optional<Product> findById(Long productId) {
        return repository.findById(productId);
    }

    @Override
    public void save(Product product) {
        repository.save(product);
    }
}
